package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 客户对账单表
 * @TableName customer_reconciliation
 */
@TableName(value ="customer_reconciliation")
@Data
public class CustomerReconciliation implements Serializable {
    /**
     * 对账单ID
     */
    @TableId(type = IdType.AUTO)
    private Long recoId;

    /**
     * 对账单号
     */
    private String recoCode;

    /**
     * 客户Id
     */
    private Long customerId;

    /**
     * 客户名称（关联查询）
     */
    @TableField(exist = false)
    private String customerName;

    /**
     * 对账状态（0：待对账；1：部分对账；2：全部对账 ）
     */
    private Integer status;

    /**
     * 账单起始日期
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

    private Date createDate;

    /**
     * 账单终止日期
     */

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

    private Date endDate;

    /**
     * 应收款
     */
    private BigDecimal currentReceivable;

    /**
     * 待收款
     */
    private BigDecimal currentToReceive;

    /**
     * 已收款
     */
    private BigDecimal currentReceived;

    /**
     * 财务人员
     */
    private String financialStaff;



    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CustomerReconciliation other = (CustomerReconciliation) that;
        return (this.getRecoId() == null ? other.getRecoId() == null : this.getRecoId().equals(other.getRecoId()))
            && (this.getRecoCode() == null ? other.getRecoCode() == null : this.getRecoCode().equals(other.getRecoCode()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
            && (this.getEndDate() == null ? other.getEndDate() == null : this.getEndDate().equals(other.getEndDate()))
            && (this.getCurrentReceivable() == null ? other.getCurrentReceivable() == null : this.getCurrentReceivable().equals(other.getCurrentReceivable()))
            && (this.getCurrentToReceive() == null ? other.getCurrentToReceive() == null : this.getCurrentToReceive().equals(other.getCurrentToReceive()))
            && (this.getCurrentReceived() == null ? other.getCurrentReceived() == null : this.getCurrentReceived().equals(other.getCurrentReceived()))
            && (this.getFinancialStaff() == null ? other.getFinancialStaff() == null : this.getFinancialStaff().equals(other.getFinancialStaff()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getRecoId() == null) ? 0 : getRecoId().hashCode());
        result = prime * result + ((getRecoCode() == null) ? 0 : getRecoCode().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getEndDate() == null) ? 0 : getEndDate().hashCode());
        result = prime * result + ((getCurrentReceivable() == null) ? 0 : getCurrentReceivable().hashCode());
        result = prime * result + ((getCurrentToReceive() == null) ? 0 : getCurrentToReceive().hashCode());
        result = prime * result + ((getCurrentReceived() == null) ? 0 : getCurrentReceived().hashCode());
        result = prime * result + ((getFinancialStaff() == null) ? 0 : getFinancialStaff().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", recoId=").append(recoId);
        sb.append(", recoCode=").append(recoCode);
        sb.append(", customerId=").append(customerId);
        sb.append(", status=").append(status);
        sb.append(", createDate=").append(createDate);
        sb.append(", endDate=").append(endDate);
        sb.append(", currentReceivable=").append(currentReceivable);
        sb.append(", currentToReceive=").append(currentToReceive);
        sb.append(", currentReceived=").append(currentReceived);
        sb.append(", financialStaff=").append(financialStaff);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
